package ch8;

import java.util.Scanner;

/**
 * @author oldliu
 * @since 1.0
 */
public class Array5 {
    public static void main(String[] args) {
        //查找数据是否在数组中
        int a[] = {1, 46, 44, 67, 23, 60, 55, 780, 9};
        Scanner in = new Scanner(System.in);
        System.out.println("请输入要查找的数:");
        int k = in.nextInt();
        //判断不在的时候早了。。。有问题
        boolean isIn = false;//假设不在
        for (int i = 0; i < a.length; i++) {
            if (k == a[i]) {
                System.out.println("数组中包含此数");
                isIn = true;
                break;
            }
        }

        if (!isIn)
            System.out.println("数组中不包含此数");

    }
}
